﻿@{
    var arr = new[]
    {
        new { Part = "ProductsCount", Label = T("Admin.Catalog.Products").Value, Title = T("Admin.Catalog.Products").Value, Icon = "fa fa-cubes" },
        new { Part = "AttributesCount", Label = T("Admin.Catalog.Attributes").Value, Title = T("Admin.Catalog.Attributes.ProductAttributes").Value, Icon = "far fa-list-alt" },
        new
        {
            Part = "AttributeCombinationsCount",
            Label = T("Admin.Catalog.Products.ProductVariantAttributes.AttributeCombinations.Short").Value,
            Title = T("Admin.Catalog.Products.ProductVariantAttributes.AttributeCombinations").Value,
            Icon = "fa fa-layer-group"
        },
        new { Part = "CategoriesCount", Label = T("Admin.Catalog.Categories").Value, Title = T("Admin.Catalog.Categories").Value, Icon = "fa fa-sitemap" },
        new { Part = "ManufacturersCount", Label = T("Admin.Catalog.Manufacturers").Value, Title = T("Admin.Catalog.Manufacturers").Value, Icon = "far fa-building" },
        new { Part = "MediaCount", Label = T("Admin.Catalog.Products.Pictures").Value, Title = T("Admin.Catalog.Products.Pictures").Value, Icon = "far fa-images" },
        new { Part = "CustomersCount", Label = T("Admin.Customers.Customers").Value, Title = T("Admin.Customers.Reports.RegisteredCustomers").Value, Icon = "fa fa-users" },
        new { Part = "OrdersCount", Label = T("Admin.Orders").Value, Title = T("Admin.Orders.Overall").Value, Icon = "fa fa-chart-bar" },
        new
        {
            Part = "Sales",
            Label = T("Admin.SalesReport.Sales").Value,
            Title = T("Admin.SalesReport.Sales.Hint").Value + " " + T("Enums.TaxDisplayType.IncludingTax").Value,
            Icon = "far fa-credit-card"
        },
        new { Part = "OnlineCustomersCount", Label = T("Admin.Customers.OnlineCustomers").Value, Title = T("Admin.Report.OnlineCustomers").Value, Icon = "fa fa-user-check" },
        new
        {
            Part = "CartsValue",
            Label = T("Admin.CurrentCarts.Short").Value,
            Title = T("Admin.CurrentCarts").Value + " " + T("Enums.TaxDisplayType.IncludingTax").Value,
            Icon = "fa fa-cart-arrow-down"
        },
        new
        {
            Part = "WishlistsValue",
            Label = T("Admin.CurrentWishlists.Short").Value,
            Title = T("Admin.CurrentWishlists").Value + " " + T("Enums.TaxDisplayType.IncludingTax").Value,
            Icon = "far fa-heart"
        }
    };
}

<div class="report">
    <div class="report-title-row">
        <div class="report-title">@T("Admin.Report.StoreStatistics")</div>
    </div>
    <div class="statistics-container pt-2 pb-3">
        <div class="row pl-4 pr-3 m-0">
            @for (int i = 0; i < arr.Length; i++)
            {
                <div class="col-6 col-md-4 statistics-col">
                    <div class="statistics-content">
                        <div class="statistics-icon">
                            <i class="@arr[i].Icon"></i>
                        </div>
                        <div class="statistics-container-outer">
                            <div class="statistics-container-inner">
                                <div class="statistics-value" data-part="@arr[i].Part"></div>
                                <div class="statistics-attribute" title="@arr[i].Title">@arr[i].Label</div>
                            </div>
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>
</div>

<script sm-target-zone="scripts" data-origin="DashboardStoreReport">
    $(function () {
        $.ajax({
            url: "@(Url.Action("StoreDashboardReport", "Store"))",
            type: "GET",
            cache: false,
            success: function (data) {
                var elements = $('.statistics-value');
                elements.each(function (i, element) {
                    var part = $(element).data('part');
                    $(element).html(data.model[part]);
                    $(element).attr('title', data.model[part]);
                });
            }
        });
    });
</script>